package tests;

import java.io.FileInputStream;
import java.io.IOException;

import junit.framework.TestCase;

public class FISReaderTest extends TestCase {
	private String fileName="/Users/Maco/Desktop/pruebasSeg/fileForFIS.txt";
	private String text="One two three";

	public void testReadString() {
		try {
			FileInputStream f=new FileInputStream(this.fileName);
			byte[] b=new byte[f.available()];
			f.read(b);
			f.close();
			String read=new String(b);
			assertTrue("Esperado: " + this.text + "; obtenido: " + read, read.equals(this.text));
		} catch (IOException e) {
			fail("Not expected: " + e.toString());
		}
	}

	public void testReadStringIntInt() {
		try {
			FileInputStream f=new FileInputStream(this.fileName);
			byte b[]=new byte[this.text.length()];
			f.read(b, 0, this.text.length());
			f.close();
			String read=new String(b);
			assertTrue("Esperado: " + this.text + "; obtenido: " + read, read.equals(this.text));
		} catch (IOException e) {
			fail("Not expected: " + e.toString());
		}
	}

}
